<template name="chooseWarehouseList">
	<view>
		<scroll-view scroll-y class="page">
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="content">仓库列表</block>
		</cu-custom>
		<view>
			<u-toast ref="uToast"></u-toast>
			<view class="cu-list menu sm-border card-menu margin-top " >
				<view class="cu-item arrow animation-slide-bottom" v-for="(item,index) in warehouseList" @tap="chooseWarehouse(item)">
					<view class="content">
						<text class="cuIcon-playfill text-blue"></text>
						<text class="text-grey">{{item.name}}</text>
					</view>
				</view>
			</view>
		</view>
		</scroll-view>
	</view>
</template>



<script>
	import { mapActions } from "vuex"
	export default {
		data() {
			return {
				warehouseList:[],
			}
		},
		onLoad:function(option){
			if(!option.item){
				uni.navigateTo({
					url: '/pages/wms/chooseOrgList'
				});
			}
			const tempItem = JSON.parse(decodeURIComponent(option.item));
			this.warehouseList = tempItem;
		},
		methods: {
			...mapActions(["warehouseChoose"]),
			chooseWarehouse(item){
				var that = this;
				this.warehouseChoose(item);
				// this.$tip.success('登录成功!')
				this.$refs.uToast.show({
						type: 'success',
						title: '成功',
						message: "登录成功",
						complete() {
							that.$Router.replaceAll({name:'index'})			
						}
				})
			},
		}
	}
</script>

<style>
</style>